<?php
namespace app\h5api\controller;

use app\common\model\Signin;
use think\Request;

class Sign extends Base
{
    /**
     * @route('h5/UserSignInfo')
     * 用户签到信息
     */
    public function UserSignInfo()
    {
//        var_dump($this->getuserinfo());die;
        $signModel = new Signin();
        $signinfo = $signModel->signinfo($this->_userid);
        $data = [
            "signinfo" => $signinfo,
            "nowdate" => date('Y-m-d',time()),
//            "userinfo" => $this->getuserinfo(),
        ];
        return $this->result($data,1,'返回信息');
    }

    /**
     * @route('h5/UserSignIn')
     * 用户签到操作
     */
    public function UserSignIn()
    {
        $intergal = 20;
        $signModel = new Signin();
        $rs = $signModel->usersignin($this->_userid,$this->getuserinfo(),$intergal);
        if(!$rs){
            $this->result('',-1,$signModel->getError());
        }
        $this->result('',1,'签到成功');
    }
}
